<template>
  <div>
    <MyHeader />
    <div class="main">
      <keep-alive>
        <components :is="isCom"></components>
      </keep-alive>
    </div>
    <MyTabBar :tabs="tabList" @changeCom="changeFn"></MyTabBar>
  </div>
</template>

<script>
import MyHeader from "@/components/MyHeader";
import MyTabBar from "@/components/MyTabBar";
import MyGoodsList from "@/components/MyGoodsList";
import MyGoodsSearch from "@/components/MyGoodsSearch";
import MyUserInfo from "@/components/MyUserInfo";
export default {
  components: {
    MyHeader,
    MyTabBar,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo,
  },
  methods: {
    changeFn(ind) {
      this.isCom = this.tabList[ind].name;
    },
  },
  data() {
    return {
      isCom: "MyGoodsList", // 页面默认显示的
      tabList: [
        {
          icon: "icon-shangpinliebiao",
          text: "商品列表",
          name: "MyGoodsList",
        },
        {
          icon: "icon-sousuo",
          text: "商品搜索",
          name: "MyGoodsSearch",
        },
        {
          icon: "icon-user",
          text: "我的信息",
          name: "MyUserInfo",
        },
      ]
    };
  },
};
</script>

<style scoped>
.main {
  padding: 50px 0;
}
</style>